import { createStore } from 'vuex'

export default createStore({
  state: {
    machineInfo: JSON.parse(sessionStorage.getItem('machineInfo') as string),
    tableData: [],
    axisX: []
  },
  getters: {
    getMachine: state => {
      return state.machineInfo
    },
    getData: state => {
      return state.tableData
    },
    getX: state => {
      return state.axisX
    }
  },
  mutations: {
    SET_MACHINEINFO: (state, machineInfo) => {
      state.machineInfo = machineInfo
      console.log(state.machineInfo)
      sessionStorage.setItem('machineInfo', JSON.stringify(machineInfo))
    }
  },
  actions: {
  },
  modules: {
  }
})
